from base.base import BasePage


class LoginPage(BasePage):
    quec_index_url = "https://iot.quectelcn.com/login"
    username = ("css selector", "input[class='loginput']")
    password = ("css selector", "input[type='password']")
    confirm_check_box = ("css selector", "div[class='checkboxdiv']>label>span>span")
    login_btn = ("css selector", "div[class='btns']")
    send_mail_btn = ("css selector", "div[class='btns']>button>span")
    alert_text = ("css selector", "div[role='alert']>p")

    def login(self, username=None, password=None):
        self.open(self.quec_index_url, "移远云")
        self.fill(self.username, "870423381@qq.com", "用户名")
        self.fill(self.password, "myb19951226.", "密码")
        self.click(self.confirm_check_box, "同意协议")
        self.click(self.login_btn, "登录")
        self.get_text(self.alert_text, "登录alert提示框")


